package com.bingxue.edu.common.job;

import com.bingxue.edu.framework.job.DynamicJob;
import com.bingxue.edu.management.report.service.MonthlyTeacherLessonService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.time.YearMonth;

/**
 * @author panbo
 * @since 2024/11/28
 */
@Slf4j
@DisallowConcurrentExecution
@RequiredArgsConstructor
@DynamicJob(name="教师课时计算任务", cron = "0 0 0 2 * ? ", paramClass = DemoJobParam.class)
public class TeacherLessonComputeJob extends QuartzJobBean {

    private final MonthlyTeacherLessonService monthlyTeacherLessonService;

    @Override
    protected void executeInternal(JobExecutionContext context) {
        log.info("教师课时计算开始");
        monthlyTeacherLessonService.computeTeacherLessonReport(YearMonth.now());
        log.info("教师课时计算结束");
    }
}
